<div class="container">
	<ol class="breadcrumb">
		<li><?php echo anchor('', 'Início'); ?></li>
		<li><?php echo anchor('parasuaempresa', 'Para Sua Empresa'); ?></li>
		<li class="active">Dados Cadastrais</li>
	</ol>
</div>

<div class="container">

	<div class="row">
		<?php $this->load->view('parasuaempresa/_sidebar'); ?>

		<div class="col-md-9 col-md-9">
			
			<?php 
			$hidden = array('datetime' => date('Ymdhmi'));
			$attributes = array("role"=>"form", 'id'=>'frm_cadastro');
			echo form_open('parasuaempresa/cadastro', $attributes, $hidden); 
			?>

			<h3 class="titulos">Dados Cadastrais</h3>

			<?php
			if(!empty($formMessage) && $form_origem == 'cadastro'){
				$cssOptions = array('alert-danger', 'alert-warning', 'alert-success');
				$cssAlert = $cssOptions[$formMessage[0]-1];
				?>
				<div class="alert <?php echo $cssAlert; ?>">
					<?php echo $formMessage[1]; ?>
				</div>
				<?php
			}
			?>

			<div class="row">
				<div class="col-md-3 form-group">
					<label for="cnpj">CNPJ</label>
					<div><?php echo $empresa->getCNPJFormatted(); ?></div>
				</div>

				<div class="col-md-3 form-group">
					<label for="insc_estadual">Insc Estadual</label>
					<?php echo form_input(array('name'=>'insc_estadual','id'=>'insc_estadual','class'=>'form-control', 'value' => $formData['insc_estadual'])); ?>
				</div>

				<div class="col-md-3 form-group">
					<label for="razao_social">Razão Social</label>
					<?php echo form_input(array('name'=>'razao_social','id'=>'razao_social','class'=>'form-control', 'value' => $formData['razao_social'])); ?>
				</div>

				<div class="col-md-3 form-group">
					<label for="nome_fantasia">Nome Fantasia</label>
					<?php echo form_input(array('name'=>'nome_fantasia','id'=>'nome_fantasia','class'=>'form-control', 'value' => $formData['nome_fantasia'])); ?>
				</div>
			</div>

			<div class="row">
				<div class="col-md-3 form-group">
					<label for="telefone">Telefone</label>
					<?php echo form_input(array('name'=>'telefone','id'=>'telefone','class'=>'form-control', 'value' => $formData['telefone'])); ?>
				</div>
				<div class="col-md-3 form-group">
					<label for="celular">Celular</label>
					<?php echo form_input(array('name'=>'celular','id'=>'celular','class'=>'form-control', 'value' => $formData['celular'])); ?>
				</div>
				<div class="col-md-3 form-group">
					<label for="responsavel">Nome responsável</label>
					<?php echo form_input(array('name'=>'responsavel','id'=>'responsavel','class'=>'form-control', 'value' => $formData['responsavel'])); ?>
				</div>
				<div class="col-md-3 form-group">
					<label for="site">Site</label>
					<?php echo form_input(array('name'=>'site','id'=>'site','class'=>'form-control', 'value' => $formData['site'])); ?>
				</div>
			</div>

			<div class="row">
				<div class="col-md-3 form-group">
					<label for="segmento">Principal segmento</label>
					<?php
					$seg = array(''=>'');
					
					$optionSel = '';
					$segSel    = $empresa->getSegmentoPrincipal();
					if(!empty($segSel)){
						$optionSel = $segSel->getCodSegmento();
					}

					foreach ($segmentos as $segmento) {
						$seg[$segmento->cod_segmento_auto] = $segmento->desc_segmento;
					}

					echo form_dropdown('segmento', $seg, $optionSel, 'id="segmento" class="form-control"');
					?>
				</div>				
			</div>

			<h5>Endereço</h5>

			<div class="row">
				<div class="col-md-4 form-group">
					<label for="endereco">Endereço</label>
					<?php echo form_input(array('name'=>'endereco','id'=>'endereco','class'=>'form-control', 'value' => $formData['endereco'])); ?>
				</div>
				<div class="col-md-2 form-group">
					<label for="numero">Número</label>
					<?php echo form_input(array('name'=>'numero','id'=>'numero','class'=>'form-control', 'value' => $formData['numero'])); ?>
				</div>
				<div class="col-md-3 form-group">
					<label for="bairro">Bairro</label>
					<?php echo form_input(array('name'=>'bairro','id'=>'bairro','class'=>'form-control', 'value' => $formData['bairro'])); ?>
				</div>
				<div class="col-md-3 form-group">
					<label for="cep">CEP</label>
					<?php echo form_input(array('name'=>'cep','id'=>'cep','class'=>'form-control', 'value' => $formData['cep'])); ?>
				</div>
			</div>

			<div class="row">
				<div class="col-md-2 form-group">
					<label>Estado</label>
					<?php
					$ufs = array();
					//$ufs[''] = '';

					foreach ($estados->result() as $estado) {
						$ufs[$estado->sigla_uf] = $estado->sigla_uf;
					}

					echo form_dropdown('estado', $ufs, 'SC', 'id="estado" class="form-control"');
					?>
				</div>

				<div class="col-md-4 form-group">
					<label>Cidade</label>
					<?php
					$cid = array();
					//$cid[''] = '';

					foreach ($cidades->result() as $cidade) {
						$cid[$cidade->cod_cidade_auto] = $cidade->desc_cidade;
					}

					echo form_dropdown('cidade', $cid, 'Joinville', 'id="cidade" class="form-control"');
					?>
				</div>
			</div>

			<h5>Dados de acesso</h5>

			<div class="row">
				<div class="col-md-3 form-group">
					<label for="email">Email</label>
					<div><?php echo $empresa->getEmail(); ?></div>
				</div>
			</div>	

			<input type="submit" class="btn btn-primary pull-right" value="Atualizar Cadastro" />

			<?php echo form_close(); ?>

			<div class="clearfix"></div>

			<h3 class="titulos">Alterar minha senha</h3>

			<?php
			if(!empty($formMessage) && $form_origem == 'alterar_senha'){
				$cssOptions = array('alert-danger', 'alert-warning', 'alert-success');
				$cssAlert = $cssOptions[$formMessage[0]-1];
				?>
				<div class="alert <?php echo $cssAlert; ?>">
					<?php echo $formMessage[1]; ?>
				</div>
				<?php
			}
			?>

			<?php
			$hidden = array('datetime' => date('Ymdhmi'));
			$attributes = array('role'=>'form', 'id'=>'frm_alterar_senha');
			echo form_open('parasuaempresa/cadastro/cadastro', $attributes, $hidden); 
			?>

			<div class="row">
				<div class="col-md-3 form-group">
					<label for="senha_atual">Senha atual</label>
					<?php echo form_password(array('name'=>'senha_atual','id'=>'senha_atual','class'=>'form-control')); ?>
				</div>
				<div class="col-md-3 form-group">
					<label for="nova_senha">Nova senha</label>
					<?php echo form_password(array('name'=>'nova_senha','id'=>'nova_senha','class'=>'form-control')); ?>
				</div>
				<div class="col-md-3 form-group">
					<label for="confirmar_nova_senha">Confirmar nova senha</label>
					<?php echo form_password(array('name'=>'confirmar_nova_senha','id'=>'confirmar_nova_senha','class'=>'form-control')); ?>
				</div>
				<div class="col-md-3 form-group">
					<label for="">&nbsp;</label>
					<input type="submit" class="btn btn-primary form-control" value="Alterar senha" />
				</div>
			</div>

			<?php echo form_close(); ?>

			<div class="clearfix"></div>
		</div>
	</div>

</div>